package team3.tracking.util;

import android.location.Location;

public class Vector{
	
	private double x;
	private double y;

	public Vector(double x, double y) {
		this.x = x;
		this.y = y;
	}

	public Vector(Location location, Location lastLocation){
		
		//latitude and longitude should be the difference between the actual location and the last one fixed
		//then we have the angle and the distance implicit
		x = location.getLatitude() - lastLocation.getLatitude();
		y = location.getLongitude() - lastLocation.getLongitude();
		
		/*double bearing = location.bearingTo(lastLocation);
		double distance = location.distanceTo(lastLocation);
		x = Math.cos(90-bearing) * distance;
		y = Math.sin(90-bearing) * distance;
		*/
	}

	public double getX() {
		return x;
	}

	public double getY() {
		return y;
	}
	
	public void setX(double x) {
		this.x = x;
	}
	public void setY(double y) {
		this.y = y;
	}
	
	/*public void serialize(DataOutputStream out) {
		
		try {		
			out.writeDouble(x);
			out.writeDouble(y);

		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	  
	public void deserialize(DataInputStream in) {
	  
		try {			
			x = in.readDouble();
			y = in.readDouble();
			
		} catch (IOException e) {
			e.printStackTrace();
		}

	}*/
	
	
}
